Release 10.1A: OpenEdge Development:
Web Services
Complex data example
The following examples show how you might manage a complex parameter, or any complex data, in this case, an
OUTPUTparameter as serialized XML. This is a procedure that maps to a Web service operation,getAddress. Given a social security number (ssn), the operation returns an address (Address) as a complex type:
This is the schema for a
<complexType>element that returns the address information to the caller. It contains fivestringdata type elements representing the components of the address:
This sample 4GL procedure demonstrates how you can manage this complex type in the 4GL as a DOM tree. The variable to receive the parameter value,
cmAddress, is defined as aLONGCHAR, which is essentially aCHARACTER-compatibleMEMPTR. After the Web service operation returns a value forcmAddress, theLOAD( )method on the x-document handle,hXDoc, parses and loads the<complexType>element fromcmAddressinto the associated x-document object.Because the schema of the complex type is known, the remaining x-document and x-noderef handle methods simply retrieve the root node from the
Note: The URL for the Web service in the following example is completely fictitious, and any resemblance to an actual public Web service is coincidental.“Address”DOM tree, and pick off the component value (text element) for each of the five component nodes that comprise the complex type, in order, assigning them to the corresponding fields of a database record.This is the 4GL example for handling the parameter as a DOM tree:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |